package com.atguigu.factory.fruit;

/**
 * @author xgc
 * @create 2021-07-22 11:41
 */
public class FruitFactory {

    public Fruit createFruit(String type){
        if (type.equals("apple")){
            //生产苹果
            return new Apple();
        }else if (type.equals("pear")){
            //生产梨
            return new Pear();
        }else {
            return null;
        }
    }
}
